﻿using System;
using System.Collections.Generic;
using System.Text;

namespace program06
{
   public class CashReturn:CashSuper
    {
        private decimal _moneyCondition = 0.0M;

        private decimal _moneyReturn = 0.0M;

        public CashReturn(decimal moneyCondition, decimal moneyReturn)
        {
            this._moneyCondition = moneyCondition;
            this._moneyReturn = moneyReturn;
        }
        public override decimal AcceptCash(decimal money)
        {
            var totaPrice = money;
            if (money > _moneyCondition)
                totaPrice = money - Math.Floor(money / _moneyCondition) * _moneyReturn;
            return totaPrice;
        }
    }
}
